package com.zcxy360.sandtable.controller;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.zcxy360.sandtable.domain.CourseStudentMapper;
import com.zcxy360.sandtable.domain.OrgMapper;
import com.zcxy360.sandtable.domain.TempletMapper;
import com.zcxy360.sandtable.domain.VideoMapper;
import com.zcxy360.sandtable.service.TestService;

@RequestMapping("test")
@RestController
public class TestController {
	
	@Value("${error.path:/error2}")
	private String a;
	@Autowired
	private TestService testService;
	
	@Autowired
	private ObjectMapper om;
	@Autowired
	private VideoMapper videoMapper;
	@Autowired
	private CourseStudentMapper courseStudentMapper;
	
	
	private Logger logger = LoggerFactory.getLogger(TestController.class);
	
	@Autowired
	private OrgMapper orgMapper;

	public static void main(String[] args) {
	}
	@RequestMapping("test")
	public Object test(String date) {
		System.out.println();
		return null;
	}
	
	@RequiresRoles(value={"teacher","admin"},logical=Logical.OR)
	@RequestMapping("org")
	public Object org() {
		System.out.println(orgMapper);
		return orgMapper;
	}
	
	@PostMapping
	public Object save() {
		return "save";
	}
	@DeleteMapping
	public Object delete() {
		return "delete";
	}
	@PutMapping
	public Object update() {
		return "update";
	}
}
class A{
	private Integer id;
	private String name;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
}